<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<link rel="stylesheet" type="text/css" href="../css/denglu.css">
<link rel="stylesheet" type="text/css" href="../css/reset.css">
<script src="../js/jquery.js"></script>
<script src="../js/cookie.tools.js"></script>
<body>
<header>
    <div class="wrap header">
        <img src="../images/zhucelogo.jpg" alt="">
    </div>
</header>
<main>
    <div class="main">
        <ul class="clear">
            <li>
                手机登陆
            </li>
            <li class="current">
                账号登陆
            </li>
        </ul>
        <div class="hide">
            <div class="left">
                <form>
                    <p><input type="" placeholder="请输入手机号"></p>
                    <p><input type="" placeholder="请输入密码"></p>
                    <p>
                        <button class="btn1">登陆</button>
                    </p>

                </form>
                <p class="last">
                    <a href="zhuce.html">立即注册</a>
                </p>
                <img src="../images/denglu-图标.png" alt="">
            </div>
            <div class="right">
                <form>
                    <p><input type="" placeholder="请输入手机号/邮箱" class="inp3"></p>
                    <p><input type="" placeholder="请输入密码" class="inp4"></p>
                    <div class="div1"></div>
                    <p class="p3"><input type="checkbox" class="check"><span class="span1">下次自动登陆</span>
                        <span class="span2"><a href="#">忘记密码</a></span></p>
                    <p>
                        <button class="btn2">登陆</button>

                    </p>

                </form>
                <img src="../images/denglu-图标.png" alt="">
            </div>
        </div>
    </div>

</main>
</body>
<script>
    $(function(){
        $("main ul li").on("click", function(){
            var index = $(this).index()
            console.log(index);
            $(this).addClass("current").siblings().removeClass("current")
            $(this).css("background", "#fff").siblings().css("background", "#ccc")

            $(".hide").find("div").eq(index).show().siblings().hide()
        })
        // var obj = getCookieByName("userInfo2")
        var arr = JSON.parse(getCookieByName("userInfo2"))
        console.log(arr);
        console.log(arr.length);
        $("input").on("focus",function(){
            $(".div1").html("")
        })
        $(".btn2").on("click", function(){
            $(".div1").html("")
            for(var i = 0; i < arr.length; i++){

                console.log(i);
                console.log(arr[i].utel);
                console.log(arr[i].upwd);
                if((arr[i].utel == $(".inp3").val()) && (arr[i].upwd == $(".inp4").val())){

                    alert("登陆成功")
                    window.location="main.html"
                    break
                }else {
                    $(".div1").html("密码或账号错误")
                }



            }



            return false

        })


    })


</script>
</html>